import React, { Component } from 'react'

export default class Time extends Component {
    constructor () {
        super();
        this.state = {
            date: new Date()
        }
    }
    render() {
        let date = this.state.date;
        return (
            <>
            {/* 不允许直接显示时间格式，需要进行转换 */}
                <div>时间:{date.getFullYear() + "年" + (date.getMonth() + 1) + "月" + date.getDate() + "日"}</div>
                <div>时间 {this.state.date.format("YYYY-MM-DD")}</div>
            </>
        )
    }
}